<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 阶乘 给一个比如5，那么5的阶乘就是5*4*3*2*1   n的阶乘1*2*3*...*n
        function fun(num){
            var result = 1;
            for(var i=1;i<=num;i++){
                result *= i; // result = result * i;
            }
            return result;
            // return 1*2*3*...*num
        }

        console.log(fun(5));
    </script>
</body>
</html>